<pre>

<?php


$content = file_get_contents('http://localhost/ren/css/profile/oldprofile-all-min.css');
$_path=file('a.txt');

foreach($_path as $val)
{
	$val=str_replace("\r",'',$val);
	$val=str_replace("\n",'',$val);
	$val=str_replace("\r\n",'',$val);

	$_arr = explode("/",$val);

	$_pathimages = "http://weidiandi.com/images/".$_arr[count($_arr)-1];

	//替换编码
	$content=str_replace($val,$_pathimages,$content);

}

echo $content;

exit;

$styleFileContent = file_get_contents('http://localhost/ren/css/profile/oldprofile-all-min.css');
//匹配出需要下载的URL地址
preg_match_all("/url\((.*)\)/", $styleFileContent, $imagesURLArray);

//循环需要下载的地址，逐个下载
$imagesURLArray = array_unique($imagesURLArray[1]);
foreach($imagesURLArray as $imagesURL) {
	echo $imagesURL.'<br>';
}

exit;


preg_match_all("/<img.*src\s*=\s*[\"|\']?\s*([^>\"\'\s]*)/i",str_ireplace("\\","",$content),$arr);

//print_R($arr[1]);

$_path = $arr[1];

foreach($_path as $val)
{
	$_arr = explode("/",$val);

	$_pathimages = "http://localhost/ren/images/".$_arr[count($_arr)-1];

	//替换编码
	$content=str_replace($val,$_pathimages,$content);

}

echo $content;

exit;



	function _generateRandomString($length = 10, $addSpaces = true, $addNumbers = true)
	{  
		$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"§$%&/()=[]{}';
		$useChars = array();
		// select some random chars:    
		for($i = 0; $i < $length; $i++)
		{
			$useChars[] = $characters[mt_rand(0, strlen($characters)-1)];
		}
		// add spaces and numbers:
		if($addSpaces === true)
		{
			array_push($useChars, ' ', ' ', ' ', ' ', ' ', ' ');
		}
		if($addNumbers === true)
		{
			array_push($useChars, rand(0,9), rand(0,9), rand(0,9));
		}
		shuffle($useChars);
		$randomString = trim(implode('', $useChars));
		$randomString = substr($randomString, 0, $length);
		return $randomString;
	}

//	echo base64_encode(_generateRandomString(16, false, true));
//	echo (sha1(_generateRandomString(16, false, true)));


	$key = 'reTWWW2hKHg102LNJKM6Pw==';

	$expectedResonse = base64_encode(pack('H*', sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));

	echo $expectedResonse;

?>